/*
Copyright 2010 Bryce Alcock

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.com

 */
package com.ecocrypt.proxy.forwarder.gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 *
 * @author bryce
 */
public class MenuActionListener implements ActionListener {

    RemoteForwarderView rfv;
    public MenuActionListener(RemoteForwarderView r) {
        rfv = r;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        System.out.println("action Performed called with " + e.getActionCommand());
        if (e.getActionCommand().equals("Add Destination")) {
            //  We need the Add Destination Modal box.
            NewDestinationDialog dialog = new NewDestinationDialog(rfv);
            dialog.setVisible(true);
        } else if (e.getActionCommand().equals(ForwarderViewMenuBarBuilder.CREATE_NEW_FORWARDER)) {
            System.out.println("Creating new forwarder dialog: " + ForwarderViewMenuBarBuilder.CREATE_NEW_FORWARDER);
            CreateNewForwarderDialog dialogPanel 
                    = new CreateNewForwarderDialog(GuiUtils.findParentFrame(ForwarderViewPanel.instance), true);
            dialogPanel.setEnabled(true);
            dialogPanel.setVisible(true);
            dialogPanel.setAlwaysOnTop(true);
        }
    }


}
